//
//  MyCollectionViewCell.m
//  AroundTheWorld
//
//  Created by IfelseGo on 16/5/17.
//  Copyright © 2016年 IfelseGo an. All rights reserved.
//

#import "MyCollectionViewCell.h"


@interface MyCollectionViewCell()


@property(nonatomic,retain)UIImageView *myImageView;

@end


@implementation MyCollectionViewCell



-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubviews];
    }
    return self;
}
-(void)createSubviews
{
    self.myImageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    [self.contentView addSubview:self.myImageView];
    self.myImageView.backgroundColor = [UIColor clearColor];
    
}
-(void)setModel:(SlideModel *)model
{
    NSURL *url = nil;
    if ([model isKindOfClass:[SlideModel class]]) {
        _model = model;
        url = [NSURL URLWithString:_model.photo];
    } else {
        url = [NSURL URLWithString:(NSString *)model];
    }
     [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"114.png"]];
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
}

//重新布局cell上的子视图
-(void)layoutSubviews
{
    //当当前的cell的frame重新设置的时候,该方法会被自动执行
    [super layoutSubviews];
    self.myImageView.frame = self.contentView.bounds;
}


@end
